package com.dance.spring.learn.testdemo;

import com.dance.spring.learn.jdbc.entity.User;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.GenericApplicationContext;

public class TestLog {

    public static final Logger log = LoggerFactory.getLogger(TestLog.class);

    public static void main(String[] args) {

        log.info("test logger.....");

    }

    @Test
    public void testGenericApplicationContext() {
        //1 创建 GenericApplicationContext 对象
        GenericApplicationContext context = new GenericApplicationContext();
        //2 调用 context 的方法对象注册
        context.refresh();
        context.registerBean("user1", User.class, User::new);
        //3 获取在 spring 注册的对象
        User user = context.getBean("user1",User.class);
        System.out.println(user);
    }

}
